<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<h1>员工编辑</h1>
<form action="/employee/saveOrUpdate" method="POST">
    <input type="hidden" name="id" th:value="${employee?.id}">
    员工名称:<input type="text" name="username" th:value="${employee?.username}"><br>
    员工姓名:<input type="text" name="name" th:value="${employee?.name}"><br>

    <div th:if="${employee == null }">
        员工密码:<input type="text" name="password"th:value="${employee?.password}"><br>
    </div>
    员工邮箱:<input type="text" name="email"th:value="${employee?.email}"><br>
    员工年龄:<input type="text" name="age"th:value="${employee?.age}"><br>
    员工部门:<select name="dept.id">

    <option th:each="dept:${departments}"
            th:value="${dept.id}"
            th:text="${dept.name}"
            th:selected="${dept.id == employee?.dept?.id}"
    ></option>
</select><br/>

    是否管理员:<input type="checkbox" name="admin" th:checked="${employee?.admin}"><br>
    <input type="submit" value="提交">
</form>
</body>
</html>